package org.spiderflow.users.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.spiderflow.config.exception.ExecptionWhole;
import org.spiderflow.users.mapper.UsersMapper;
import org.spiderflow.users.entity.Users;
import org.spiderflow.users.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static org.spiderflow.config.GlobalErrorInfoEnum.PARAM_ERROR;

/**
 * Created by Nicky.Tang on 2020/4/4 9:41 PM
 *
 * @since 02.12.10
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements UsersService {
    @Autowired
    UsersMapper usersMapper;

    @Override
    public List<Users> findUserInfo(String userPhone) throws Exception {
        return usersMapper.findUserInfo(userPhone);
    }

    @Override
    public void blockUp(Users users) throws Exception {
        if (users == null || users.getUserPhone() == null) {
            throw new ExecptionWhole(PARAM_ERROR);
        }
        usersMapper.blockUp(users);
    }
}
